import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-04-07
 * Time: 10:29
 */
public class Rotate {
    //旋转
    public static void main(String[] args) {
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        Mat src = Imgcodecs.imread("flower.JPG");
        HighGui.imshow("flower", src);
        HighGui.waitKey(0);
        Mat dst = src.clone();
        Point center = new Point(src.width()/2.0, src.height()/2.0);
        Mat affineTrans = Imgproc.getRotationMatrix2D(center,30.0,1.5);
        Imgproc.warpAffine(src, dst, affineTrans, dst.size(),Imgproc.INTER_NEAREST);
        HighGui.imshow("flower", dst);
        HighGui.waitKey(0);
    }
}